<?php 
if($_GET['act']=='delete'&&$_POST['submit']!=''){
    for($i=0;$i<count($_POST['selectbox']);$i++)
    {
        $query = "delete from ".DBPREFIX."tiku where t_id=".$_POST['selectbox'][$i];
        $result = $db->query($query);
    }
    if($result){
        fs_showmsg('删除成功!','?do=tikulist');
    }
    else{
        fs_showmsg('删除失败!');
    }
}
?>
<form action="?do=tikulist&&act=delete" method="post" onsubmit="return checkBoxSelect()">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent">
  <tr><td>
    <div class="submenu_t">
            <ul>
               <li><a href="?do=tikulist"><font color="#666">试题库列表</font></a> | </li>
               <li><a href="?do=add_q">添加试题库</a> | </li>
            </ul>
    </div>
    </td>
    </tr>
    <tr><td>
                    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="question_list" id="tblist">
                            <thead>
                                    <tr>
                                            <th></th>
                                            <th>题库id</th>
                                            <th>题库名称</th>
                                            <th>题库试题数目</th>
                                            <th>题库创建时间</th>
                                            <th>题库标签</th>
                                            <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                    
                                            <?php
                                            $query = "select * from ".DBPREFIX."tiku where t_createuid=".$teacher_id;
                                            $result = $db->query($query);
                                            while($row = $db->fetch_array($result))
                                            {
                                                $count_sql = "select count(*) as num from ".DBPREFIX."question where q_tiku=".$row['t_id'];
                                                $c = $db->query($count_sql);
                                                $f = $db->fetch_array($c);
                                                $num = $f['num'];
                                            ?>
                                            <tr>
                                                    <td><input type="checkbox" name="selectbox[]" value="<?php echo $row['t_id']?>" /></td>
                                                    <td><?php echo $row['t_id']?></td>
                                                    <td><?php echo $row['t_name']?></td>
                                                    <td><?php echo $num;?></td>

                                                    <td><?php echo date("Y-m-d H:i:s",$row['t_createtime']);?></td>
                                                    <td><?php echo $row['t_tag'];?></td>
                                                    <td><input type="button" value="编辑题库" class="add_bg_g" onclick="javascript:window.location.href='?do=add_q&tid=<?php echo $row['t_id'];?>'" /></td>
                                            </tr>
                                            <?php
                                            }
                                            ?>
                                            
                                    
                            </tbody>
                    </table>
            </td></tr>
    <tr><td>
    <div class="submenu_b">
            <ul>
                <li><input type="button" name="selectall" id="allselect" value="全选"/></li>
		<li><input type="button" name="noneselect" id="noneselect" value="全不选"/></li>
        <li><input type="button" name="nonesselect" id="elseselect" value="反选"/></li>
		<li><input type="submit" name="submit"   value="删除"/></li>
            </ul>
    </div>
    </td>
    </tr>
</table>
</form>